-
Notifications
You must be signed in to change notification settings - Fork 621
show block gas limit on the chain page #7101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show block gas limit on the chain page #7101
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
|
""" WalkthroughThe RPC query in the live-stats component was updated to use "eth_getBlockByNumber" instead of "eth_blockNumber", allowing retrieval of both the latest block number and gas limit. The UI now displays the block gas limit alongside the block height, with corresponding data extraction and presentation logic added. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as ChainLiveStats Component
participant Hook as useChainStatswithRPC
participant RPC as Ethereum Node
UI->>Hook: Request latest block stats
Hook->>RPC: Call "eth_getBlockByNumber" ["latest", false]
RPC-->>Hook: Return block object (number, gasLimit, ...)
Hook-->>UI: Provide blockNumber and blockGasLimit
UI->>UI: Display block height and block gas limit
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7101 +/- ##
==========================================
- Coverage 55.59% 55.59% -0.01%
==========================================
Files 901 901
Lines 58123 58121 -2
Branches 4064 4064
==========================================
- Hits 32315 32313 -2
Misses 25703 25703
Partials 105 105
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/live-stats.tsx (1)
122-135: Consider formatting the gas limit for better readabilityThe block gas limit is typically a large number (often in the millions). Consider formatting it with commas or in a more human-readable format (e.g., "30M" instead of "30000000") for better user experience.
- <p className="fade-in-0 animate-in"> - {stats.data.blockGasLimit ?? "N/A"} - </p> + <p className="fade-in-0 animate-in"> + {stats.data.blockGasLimit + ? stats.data.blockGasLimit.toLocaleString() + : "N/A"} + </p>Alternatively, for a more compact representation:
- <p className="fade-in-0 animate-in"> - {stats.data.blockGasLimit ?? "N/A"} - </p> + <p className="fade-in-0 animate-in"> + {stats.data.blockGasLimit + ? `${(stats.data.blockGasLimit / 1_000_000).toFixed(2)}M` + : "N/A"} + </p>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/live-stats.tsx(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/live-stats.tsx (3)
35-36: Good change to use a more comprehensive RPC methodChanging from
eth_blockNumbertoeth_getBlockByNumberwith["latest", false]parameters is a good approach to fetch both block number and additional block details including gas limit, while avoiding unnecessary transaction details.
44-45: Properly parsing block data from the responseThe parsing of hexadecimal values to decimal is done correctly for both block number and gas limit.
48-49: LGTM: Return object properly updatedCorrectly updated the return object to include both the block number and block gas limit.
size-limit report 📦
|
Merge activity
|
## [Dashboard] Feature: Add Block Gas Limit to Chain Live Stats ## Notes for the reviewer as requested by @0xFirekeeper This PR enhances the chain live stats component by adding the block gas limit information. The RPC method has been updated from `eth_blockNumber` to `eth_getBlockByNumber` to fetch additional block data including the gas limit. ## How to test The block gas limit should now be displayed alongside other chain statistics in the dashboard. The component handles loading and error states appropriately. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added display of the latest block's gas limit in the live stats section, including proper handling of loading, error, and unavailable states. - **Enhancements** - Improved the accuracy of live stats by retrieving and displaying more detailed block information. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
ee6b927 to
ea23190
Compare
## [Dashboard] Feature: Add Block Gas Limit to Chain Live Stats ## Notes for the reviewer as requested by @0xFirekeeper This PR enhances the chain live stats component by adding the block gas limit information. The RPC method has been updated from `eth_blockNumber` to `eth_getBlockByNumber` to fetch additional block data including the gas limit. ## How to test The block gas limit should now be displayed alongside other chain statistics in the dashboard. The component handles loading and error states appropriately. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added display of the latest block's gas limit in the live stats section, including proper handling of loading, error, and unavailable states. - **Enhancements** - Improved the accuracy of live stats by retrieving and displaying more detailed block information. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- start pr-codex --> --- ## PR-Codex overview This PR updates the `live-stats.tsx` component to fetch the latest block information using the `eth_getBlockByNumber` method instead of `eth_blockNumber`. It also introduces the display of the block gas limit in the UI. ### Detailed summary - Changed JSON-RPC method from `eth_blockNumber` to `eth_getBlockByNumber`. - Updated parameters to fetch the latest block. - Added parsing for `blockGasLimit` from the response. - Modified return object to include `blockGasLimit`. - Introduced a new UI section to display the block gas limit. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
ea23190 to
e7f7a32
Compare

[Dashboard] Feature: Add Block Gas Limit to Chain Live Stats
Notes for the reviewer
as requested by @0xFirekeeper
This PR enhances the chain live stats component by adding the block gas limit information. The RPC method has been updated from
eth_blockNumbertoeth_getBlockByNumberto fetch additional block data including the gas limit.How to test
The block gas limit should now be displayed alongside other chain statistics in the dashboard. The component handles loading and error states appropriately.
Summary by CodeRabbit
New Features
Enhancements
PR-Codex overview
This PR updates the
live-stats.tsxcomponent to fetch and display the latest block number and gas limit from the blockchain. It changes the RPC method used for fetching data and introduces new UI elements to present the block gas limit.Detailed summary
eth_blockNumbertoeth_getBlockByNumber.blockGasLimitin the returned data.